package ar.com.spsolutions.splilabrary.view.pages.category;

import org.apache.wicket.spring.injection.annot.SpringBean;

import ar.com.spsolutions.splibrary.book.category.Category;
import ar.com.spsolutions.splibrary.general.RoleConverterService.RolesEnum;
import ar.com.spsolutions.splibrary.services.dto.CRUDCategoryDTO;
import ar.com.spsolutions.splilabrary.view.components.CRUDComponent;
import ar.com.spsolutions.splilabrary.view.version2.components.MainContainer;

public class CategoryEditorComponent extends MainContainer {

	private static final long serialVersionUID = -4109231097254041246L;

	@SpringBean
	private CRUDCategoryDTO crudCategoryDTO;

	@Override
	protected void addComponents() {
		final CRUDComponent<Category> crudComponent = new CRUDComponent<Category>(
				"categoryCRUD", "header", "footer", "data",
				this.getCrudCategoryDTO(), new String[] { "name:true" });
		crudComponent.addText("name", "nameLabel", RolesEnum.ROLE_LIBRARIAN);
		this.add(crudComponent);
	}

	public CRUDCategoryDTO getCrudCategoryDTO() {
		return this.crudCategoryDTO;
	}

	public void setCrudCategoryDTO(final CRUDCategoryDTO crudCategoryDTO) {
		this.crudCategoryDTO = crudCategoryDTO;
	}

}
